package cn.jingyuan.owl.model.core;

import java.io.Serializable;

/**
 * 扩展响应模型
 *
 * @param <D> 响应数据的类型
 * @param <E> 附件数据的类型
 */
public class ExtResult<D, E> extends Result<D> implements Serializable {

    /** 附加数据 */
    protected E extra;

    public ExtResult(String code, String codeMsg) {
        this(code, codeMsg, null, null);
    }

    public ExtResult(String code, String codeMsg, D data) {
        this(code, codeMsg, data, null);
    }

    public ExtResult(String code, String codeMsg, D data, E extra) {
        super(code, codeMsg, data);
        this.extra = extra;
    }

    @Override
    public ExtResult<D, E> setCode(String code) {
        super.setCode(code);
        return this;
    }

    @Override
    public ExtResult<D, E> setCodeMsg(String codeMsg) {
        super.setCodeMsg(codeMsg);
        return this;
    }

    @Override
    public ExtResult<D, E> setData(D data) {
        super.setData(data);
        return this;
    }

    public E getExtra() {
        return extra;
    }

    public ExtResult<D, E> setExtra(E extra) {
        this.extra = extra;
        return this;
    }

}
